package org.lottery.util;

import java.util.HashSet;
import java.util.Set;

public class CalcUtil {

    public static Set<Integer> findBingo(int min, int max, int numBingo) {

        Set<Integer> bingos = new HashSet<Integer>();
        try {
            while (bingos.size() < numBingo) {
                int range = (max - min) + 1;
                for (int i = 0; i < numBingo; i++) {
                    if (bingos.size() >= numBingo)
                        break;
                    bingos.add(Integer.valueOf((int) (Math.random() * range)));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bingos;
    }

}
